package com.heima.behavior.controller;

import com.heima.behavior.Service.BehaviorService;
import com.heima.model.common.Behavior.dto.BehaviorDto;
import com.heima.model.common.Behavior.dto.LikeBehaviorDto;
import com.heima.model.common.Behavior.dto.ReadBehaviorDto;
import com.heima.model.common.dtos.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping(("/api/v1"))
public class BehaviorController {
    @Autowired
    private BehaviorService behaviorService;

    /**
     * 点赞/取消
     */
    @PostMapping("/likes_behavior")
    public ResponseResult likerBehavior(@RequestBody LikeBehaviorDto dto){
     return  behaviorService.likerBehavior(dto);
    }
    /**
     * 阅读
     */
    @PostMapping("read_behavior")
    public ResponseResult readBehavior(@RequestBody ReadBehaviorDto dto){
    return  behaviorService.readBehavior(dto);
    }

    /**
     *  文章收藏
     */
    @PostMapping("/collection_behavior")
    public ResponseResult collectionBehavior(@RequestBody BehaviorDto dto){

        return behaviorService.collectionBehavior(dto);
    }
}
